<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add Book</title>
<script type="text/javascript">
function displayResult(x)
{
if(x=="1")
	{

//alert("1");
document.getElementById("2").disabled = true;
document.getElementById("2").value="";
document.getElementById("1").disabled = false;
	}
else if(x=="2")
{
	//alert("2");
	document.getElementById("1").disabled = true;
	document.getElementById("1").value="";
	document.getElementById("2").disabled = false;
}
}
</script>
</head>
<%@taglib prefix="s" uri="/struts-tags"%>
<body>

	<form method="post" action="editbook.action?edit=submit">
		<table>
<s:iterator value="list">
			<tr>
				<td>Book Id</td>
				<td><s:property value="book_id"/><input type="hidden" name="book_id" value='<s:property value="book_id"/>'/></td>
			</tr>
			<tr>
				<td>Book Name</td>
				<td><input type="text" name="book_name" value='<s:property value="book_name"/>' required="true"/></td>
			</tr>
			<tr>
				<td>Author Name</td>
				<td><input type="text" name="author_name" value='<s:property value="author_name"/>' required="true"/></td>
			</tr>
			<tr>
				<td>Price</td>
				<td><input type="text" name="price" value='<s:property value="price"/>' required="true"/></td>
			</tr>
			<tr>
				<td>Description</td>
				<td><input type="text" name="description" value='<s:property value="description"/>' required="true"/></td>
			</tr>
			<tr>
				<td>Publisher</td>
				<td><input type="text" name="publisher" value='<s:property value="publisher"/>' required="true"/></td>
			</tr>
			<tr>
				<td>Referred By</td>
				<td><input type="text" name="referred_by" value='<s:property value="referred_by"/>' required="true"/></td>
			</tr>
			
			
<!-- 		<tr>
				<td>Number of books</td>
				<td><input type="text" name="count" /></td>
			</tr> -->
			</s:iterator>
			<tr>
				<td>Category</td>
				
				
				<td>Choose from existing : 
				<input type="radio"	name="categoryRadio" checked="checked" onchange="displayResult(1)" /> 
				<select id="1" name="category">
				<option value="" style="display: none;"></option>
				<s:iterator value="bookCategories">
				<option><s:property value="category"/></option>
				</s:iterator>
				</select> <br> 
				
				
				Add new Category : 
				<input type="radio"	name="categoryRadio" onchange="displayResult(2)" />
				<input	type="text" name="category" id="2" disabled="disabled"/>
				</td>
			</tr>
			<tr><td><input type="submit"></td></tr>		
		</table>

	</form>
	hello..!!

</body>
</html>